package proxyMethod.Impl;

import proxyMethod.BookStore;

public class BookStoreProxy implements BookStore {
    private RealBookStore realBookStore;
    private boolean isAdminUser;

    public BookStoreProxy(boolean isAdminUser) {
        this.isAdminUser = isAdminUser;
    }

    @Override
    public void displayBookDetails(String bookId) {
        if (isAdminUser) {
            if (realBookStore == null) {
                realBookStore = new RealBookStore();
            }
            realBookStore.displayBookDetails(bookId);
        } else {
            System.out.println("Access Denied: Only admin users can view book details.");
        }
    }
}
